package jy.game.components.save;


import jy.game.components.wuxue.box.JyInternalSkillInstance;
import jy.game.components.wuxue.box.JySkillInstance;
import jy.game.components.wuxue.box.JySpecialSkillInstance;
import jy.game.tools.CommonSettings;
import wx.xml.simpleframework.xml.Attribute;

// [XmlType]
public class JyGameSaveRoleSkill {
    @Attribute public int    equipped;
    @Attribute public int    level;
    @Attribute public int    exp;
    @Attribute public String name;

    static JyGameSaveRoleSkill build(String name, int level, int exp, int equipped) {
        JyGameSaveRoleSkill skill = new JyGameSaveRoleSkill();
        skill.name = name;
        skill.level = level;
        skill.exp = exp;
        skill.equipped = equipped;
        return skill;
    }

    public static JyGameSaveRoleSkill Create(JySkillInstance s) {
        return JyGameSaveRoleSkill.build(
            s.Name,
            s.level,
            s.Exp,
            s.equipped
        );
    }

    public static JyGameSaveRoleSkill Create(JyInternalSkillInstance s) {
        return JyGameSaveRoleSkill.build(
            s.Name,
            s.level,
            s.exp,
            s.equipped
        );
    }

    public static JyGameSaveRoleSkill Create(JySpecialSkillInstance s) {
        return JyGameSaveRoleSkill.build(
            s.Name,
            0,
            0,
            s.equipped
        );
    }

//    public JySkillInstance GenerateSkill() {
//        JySkillInstance skillInstance = new JySkillInstance(
//            this.name,
//            Math.min(this.level, CommonSettings.MAX_SKILL_LEVEL),
//            this.exp,
//            this.equipped
//        );
//        skillInstance.refreshUniqueSkills();
//        return skillInstance;
//    }
//
//    public JyInternalSkillInstance GenerateInternalSkill() {
//        JyInternalSkillInstance internalSkillInstance = new JyInternalSkillInstance(
//            this.name,
//            Math.min(this.level, CommonSettings.MAX_INTERNALSKILL_LEVEL),
//            this.exp,
//            this.equipped
//        );
//        internalSkillInstance.refreshUniqueSkills();
//        return internalSkillInstance;
//    }
//
//    public JySpecialSkillInstance GenerateSpecialSkill() {
//        return new JySpecialSkillInstance(
//            this.name, this.equipped
//        );
//    }
}